'\" te
.\" Copyright 1989 AT&T
.\" Copyright (c) 2002Sun Microsystems, Inc.  All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH LINK 8 "Oct 9, 2002"
.SH NAME
link, unlink \- link and unlink files and directories
.SH SYNOPSIS
.LP
.nf
\fB/usr/sbin/link \fR \fIexisting-file\fR \fInew-file\fR
.fi

.LP
.nf
\fB/usr/xpg4/bin/link \fR \fIexisting-file\fR \fInew-file\fR
.fi

.LP
.nf
\fB/usr/sbin/unlink\fR \fIfile\fR
.fi

.SH DESCRIPTION
.sp
.LP
The \fBlink\fR and \fBunlink\fR commands link and unlink files and directories.
Only super-users can use these commands on directories.
.sp
.LP
Use \fBlink\fR to create a new file that points to an existing file. The
\fIexisting-file\fR and  \fInew-file\fR operands  specify the existing file and
newly-created files.  See \fBOPERANDS\fR.
.sp
.LP
\fBlink\fR and  \fBunlink\fR directly invoke the \fBlink\fR(2) and
\fBunlink\fR(2) system calls, performing exactly what they are told to do and
abandoning all error checking. This differs from the  \fBln\fR(1) command. See
\fBln\fR(1).
.sp
.LP
While linked files and directories can be removed using \fBunlink\fR, it is
safer to use \fBrm\fR(1) and \fBrmdir\fR(1) instead. See  \fBrm\fR(1) and
\fBrmdir\fR(1).
.SS "/usr/xpg4/bin/link"
.sp
.LP
If the existing file being hard linked is itself a symbolic link, then the
newly created file (\fInew-file\fR) will be a hard link to the file referenced
by the symbolic link, not to the symbolic link object itself
(\fIexisting-file\fR).
.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIexisting-file\fR\fR
.ad
.RS 17n
Specifies the name of the existing file to be linked.
.RE

.sp
.ne 2
.na
\fB\fIfile\fR\fR
.ad
.RS 17n
Specifies the name of the file to be unlinked.
.RE

.sp
.ne 2
.na
\fB\fInew-file\fR\fR
.ad
.RS 17n
Specifies the name of newly created (linked) file.
.RE

.SH ENVIRONMENT VARIABLES
.sp
.LP
See  \fBenviron\fR(7) for descriptions of the following environment variables
that affect the execution of  \fBlink\fR: \fBLANG\fR, \fBLC_ALL\fR,
\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.SS "/usr/xpg4/bin/link"
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Standard
.TE

.SH SEE ALSO
.sp
.LP
.BR ln (1),
.BR rm (1),
.BR link (2),
.BR unlink (2),
.BR attributes (7),
.BR environ (7),
.BR standards (7)
